﻿namespace MicroCloud.Identity.Database
{
    /// <summary>
    /// 角色信息数据实体映射配置
    /// </summary>
    public class RoleConfiguration : EntityTypeConfigurationBase<Role, long>
    {
        /// <summary>
        /// 重写以实现实体类型各个属性的数据库配置
        /// </summary>
        /// <param name="builder">实体类型创建器</param>
        public override void Configuration(EntityTypeBuilder<Role> builder)
        {
            //builder.HasIndex(m => new { m.NormalizedName, m.DeletedTime }).HasDatabaseName("IDX_Role_Name").IsUnique().HasFilter(null);
            builder.HasIndex(m => new { m.NormalizedName, m.DeletedTime }).SetIndex("Name", true).HasFilter(null);

            ConfigurationAppend(builder);
        }

    }
}